document.querySelector('[type="button"]').onclick = function(){
    var phone = document.querySelector('[name="phone"]').value
    var password = document.querySelector('[name="password"]').value
    if(phone === ''){
        alert('用户名不能为空')
        return false;
    }
    if(password === ''){
        alert('密码不能为空')
        return false;
    }
    sendAjax({
        url:"login.php",
        method:"post",
        data:{
            phone,
            password
        },
        //对象简写
        success(res){
            // res=JSON.parse(res)
            var {meta:{status,message}}=res;
            alert(message)
            if(status===1){
                sCookie('phone',phone,7200)
                //判断是否被迫
                let url = localStorage.getItem('url')
                if(url){
                    localStorage.removeItem('url')
                    location.href ="url"
                }else{
                    location.href = "./home.html"
                }
                
            }
        },
        // dataType:"string"
    })
}